package com.huluobo.a2203parkdemo.notice

import androidx.lifecycle.MutableLiveData
import com.huluobo.base.mvvm.BaseViewModel
import com.huluobo.base.net.ApiService
import dagger.hilt.android.lifecycle.HiltViewModel
import okhttp3.RequestBody
import javax.inject.Inject

/**
 *  Created by LC on 2024/8/6.
 */
@HiltViewModel
class NoticeViewModel @Inject constructor(
    val apiService: ApiService
) : BaseViewModel() {
    val getAllNoticeSuccess by lazy { MutableLiveData<String>() }

    fun getAllNotice(body: RequestBody) {
        executeNetRequest(
            { apiService.queryNotice(body) },
            getAllNoticeSuccess::postValue
        )
    }

    val addNoticeSuccess by lazy { MutableLiveData<String>() }

    fun addNotice(body: RequestBody) {
        executeNetRequest(
            { apiService.addNotice(body) },
            addNoticeSuccess::postValue
        )
    }
}